#include <iostream>
#include <vector>
using namespace std;
 
int main()
{
    int n = 0, aMax = 0;
    cin >> n;
    vector<int> a(n);
    for(int i = 0 ; i < n; ++i)
    {
        cin >> a[i];
        aMax = max(aMax, a[i]);
    }
    for(int i = 0 ; i < n; ++i)
    {
        while(a[i] < aMax)
        {
            a[i] *= 2;
        }
        if(a[i] > aMax)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}